package com.example.springboot.exception;

import com.example.springboot.enums.ResultCode;
import lombok.Data;

/**
 * @author: wyb
 * @date: 2021/10/29 11:03
 * @describe: 业务异常
 * @vision 1.0
 */
@Data
public class BusException extends RuntimeException {
    private Integer code;
    private String msg;

    public BusException(){}

    public BusException(String msg){
        super(msg);
        this.msg = msg;
    }

    public BusException(int code,String msg){
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public BusException(String msg,Throwable t){
        super(msg,t);
        this.msg = msg;
    }

    public BusException(ResultCode resultCode){
        super(resultCode.getDesc());
        this.msg = resultCode.getDesc();
        this.code = resultCode.getCode();
    }
}
